package myJs.myPkg

import org.scalajs.dom.{Blob, Element}
import slinky.readwrite.ObjectOrWritten

import scala.concurrent.Future
import scala.scalajs.js
import scala.scalajs.js.UndefOr
import scala.scalajs.js.annotation.JSImport

/**
 * Created by yz on 2019/3/14
 */
@JSImport("jszip", JSImport.Namespace)
@js.native
class JSZip extends js.Object {

  def file(name: String): ZipObject = js.native

  def file(name: String, data: String): ZipObject = js.native

  def file(name: String, data: String, options: ObjectOrWritten[JSZipOptions]): ZipObject = js.native

  def folder(name: String): JSZip = js.native

  def generateAsync(options: ObjectOrWritten[GenerateOptions]): js.Promise[Blob] = js.native

}

case class JSZipOptions(
                         base64: js.UndefOr[Boolean] = js.undefined
                       )

case class GenerateOptions(
                            `type`: js.UndefOr[String] = js.undefined
                          )

@js.native
trait ZipObject extends js.Object {


}
